<!DOCTYPE html>
<html>
<head>
    <title></title>
    #parse("sys/header.html")
</head>
<body class="gray-bg">
<div id="rrapp" v-cloak class="wrapper wrapper-content animated fadeInRight" style="margin: 0px 0px;padding: 0px">
    <div class="row">

        <div class="col-sm-6" style="padding-left: 0px">
            <table class="table table-bordered table-striped text-center">
                <tr>
                    <td colspan="2"><strong>订单编号：</strong></td>
                    <td colspan="6">{{order.orderNo}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr>
                    <td colspan="2"><strong>用户名：</strong></td>
                    <td colspan="2">{{order.userName}}</td>
                    <td colspan="2"><strong>手机号：</strong></td>
                    <td colspan="2">{{order.userPhone}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr>
                    <td colspan="2"><strong>收货人：</strong></td>
                    <td colspan="2">{{order.receiveUser}}</td>
                    <td colspan="2"><strong>收货人手机号：</strong></td>
                    <td colspan="2">{{order.receivePhone}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr v-show="!isNew">
                    <td colspan="2"><strong>产品名：</strong></td>
                    <td colspan="2">{{order.productName}}</td>
                    <td colspan="2"><strong>数量：</strong></td>
                    <td colspan="2">{{order.number}}</td>
                </tr>
                <tr v-show="!isNew">
                    <td colspan="8"></td>
                </tr>
                <template v-for="(item,index) in list">
                    <tr>
                        <td colspan="2"><strong>产品名{{index+1}}：</strong></td>
                        <td colspan="1">{{item.proName}}</td>
                        <td colspan="1"><strong>产品款式{{index+1}}：</strong></td>
                        <td colspan="2">{{item.styleName}}</td>
                        <td colspan="1"><strong>数量：</strong></td>
                        <td colspan="1">{{item.num}}</td>
                    </tr>
                    <tr>
                        <td colspan="8"></td>
                    </tr>
                </template>
                <tr>
                    <td colspan="2"><strong>付款方式：</strong></td>
                    <td>{{order.payWay}}</td>
                    <td ><strong>订单金额：</strong></td>
                    <td>{{order.amount}}</td>
                    <td colspan="2"><strong>实付金额：</strong></td>
                    <td>{{order.realAmount}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr>
                    <td colspan="2"><strong>物流单号：</strong></td>
                    <td colspan="6">{{order.logisticsno}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr>
                    <td colspan="2"><strong>收货地址：</strong></td>
                    <td colspan="6">{{order.addressStr}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr>
                    <td colspan="2"><strong>订单状态:</strong></td>
                    <td colspan="2">{{order.status}}</td>
                    <td colspan="2"><strong>付款状态:</strong></td>
                    <td colspan="2">{{order.payStatus}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr>
                    <td colspan="2"><strong>下单时间:</strong></td>
                    <td colspan="2">{{order.createDate}}</td>
                    <td colspan="2"><strong>支付时间:</strong></td>
                    <td colspan="2">{{order.payDate}}</td>
                </tr>
                <tr>
                    <td colspan="8"></td>
                </tr>
                <tr>
                    <td colspan="2"><strong>备注：</strong></td>
                    <td colspan="6">{{order.remark}}</td>
                </tr>
            </table>
        </div>
    </div>
    <div style="float: right;">
        <i-button v-if="showBtn" class="btn btn-warning dim" @click="print"><i class="fa fa-print"></i>打印
        </i-button>
    </div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
    let orderId = getQueryString("orderId");
    $(function () {
        vm.created();
    })
    var vm = new Vue({
        el: '#rrapp',
        data: {
            showBtn: true,
            list:[],
            isNew:false,
            order: {},
            orderGoods: {},
            sumRetailPrice: 0,
            nowDate: transDate(new Date())
        },
        methods: {
            print: function () {
                vm.showBtn = false;
                window.print();
            },
            created: function () {
                Ajax.request({
                    url: "../order/info/" + orderId,
                    async: false,
                    successCallback: function (r) {

                        if (r.order.status == '1') {
                            r.order.status = '未支付';
                        } else if (r.order.status == '2') {
                            r.order.status = '支付完成';
                        } else if (r.order.status == '3') {
                            r.order.status = '已取消';
                        } else if (r.order.status == '4') {
                            r.order.status = '已完成';
                        } else if (r.order.status == '5') {
                            r.order.status = '待发货';
                        } else if (r.order.status == '6') {
                            r.order.status = '已发货';
                        } else if (r.order.status == '9') {
                            r.order.status = '退款处理';
                        } else if (r.order.status == '10') {
                            r.order.status = '退款中';
                        } else if (r.order.status == '11') {
                            r.order.status = '退款完成';
                        }

                        if (r.order.payStatus == '0') {
                            r.order.payStatus = '未支付';
                        } else if (r.order.payStatus == '1') {
                            r.order.payStatus = '付款中';
                        } else if (r.order.payStatus == '2') {
                            r.order.payStatus = '已付款';
                        }

                        if (r.order.payWay == '1') {
                            r.order.payWay = '微信';
                        } else if (r.order.payWay == '2') {
                            r.order.payWay = '支付宝';
                        }

                        if (r.order.logisticsno == null) {
                            r.order.logisticsno = '未发货';
                        }
                        vm.order = r.order;
                    }
                });
                if (vm.order.productName == null || vm.order.productName ==='') {
                    vm.isNew = true;
                    Ajax.request({
                        url: "../orderdetail/queryAll?orderno=" +  vm.order.orderNo,
                        async: false,
                        successCallback: function (r) {
                            vm.list = r.list;
                            console.log(r.list);
                        }
                    });
                }
            }
        }
    });
</script>

</body>

</html>
